#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=1e5+1000;
typedef long long LL;
LL a[maxn];
int main(void)
{
  cin.tie(0);std::ios::sync_with_stdio(false);
  LL t;cin>>t;
  while(t--){
    LL n;cin>>n;
    multiset<LL>s;
    set<LL>k;
    for(LL i=1;i<=n;i++){
        cin>>a[i];
        s.insert(a[i]);
        k.insert(a[i]);
    }
    LL num=k.size();
    k.clear();
    for(LL i=n;i>=1;i--){
        if(s.find(a[i]+1)==s.end()){
            s.insert(a[i]+1);
            s.erase(s.find(a[i]));
        }
    }
    for(auto i:s){
        k.insert(i);
    }
    LL ans=k.size();
    cout<<max(num,ans)<<endl;
}
return 0;
}
